import request from './../axios'

import {requestHandle} from "./../axios";
import {API_PREFIX} from "@/assets/js/dict"

/**
 *  --------------------------------------- 家教 报名竞聘订单 Start ---------------------------------------
 */


/**
 * 家教查看已经发布的订单  
 * 
 * @method GetPublishedOrders
 * 
 */

export function GetPublishedOrders (params) {
    return request({
        url: '/tutor/action/publishedOrders',
        method: 'get',
        params
    })
}


/**
 * 家教查看一个订单的详情   
 * 
 * @method GetOrderDetails
 * 
 */

export function GetOrderDetails (params) {
    return request({
        url: '/tutor/action/orderDetails',
        method: 'get',
        params
    })
}


/**
 * 家教报名一个订单   
 * 
 * @method PostAddApply
 * 
 */

export function PostAddApply (params) {
    return request({
        url: '/tutor/action/addApply',
        method: 'post',
        params
    })
}


/**
 *  --------------------------------------- 家教 报名竞聘订单 End ---------------------------------------
 */



/**
 *  --------------------------------------- 家教 待定订单 Start ---------------------------------------
 */


/**
 * 家教待定订单列表 GET  
 * 
 * @method GetProducingApplies
 * 
 */

export function GetProducingApplies (params) {
    return request({
        url: '/tutor/action/producingApplies',
        method: 'get',
        params
    })
}


/**
 * 家教查看一个订单的详情   
 * 
 * @method PostCancelApply
 * 
 */

export function PostCancelApply (params) {
    return request({
        url: '/tutor/action/cancelApply',
        method: 'post',
        params
    })
}


/**
 * 签订一个订单，被家长选中后，家教支付中介费 POST   
 * 
 * 将返回微信支付的一些参数，并唤起微信支付功能；
 * out_trade_no：商户支付订单编号
 * 
 * @method PostPayApply
 * 
 */

export function PostPayApply (params) {
    return request({
        url: '/tutor/action/payApply',
        method: 'post',
        data: params
    })
}



/**
 * 支付结果查询  GET   
 * 
 * 查询支付结果
 * 
 * @method GetQueryApplyPay
 * 
 */

export function GetQueryApplyPay (params) {
    return request({
        url: '/tutor/action/queryApplyPay',
        method: 'post',
        data: params
    })
}



/**
 * 试讲
 * @param params
 * @param call
 */
export function trial(params, call) {
    requestHandle(request({
        url:`${API_PREFIX}/tutor/action/trial`,
        method: 'POST',
        params
    }), call)
}


/**
 * 试讲失败
 * @param params
 * @param call
 */
export function trialFail(params, call) {
    requestHandle(request({
        url:`${API_PREFIX}/tutor/action/trialFail`,
        method: 'POST',
        params
    }), call)
}

/**
 * 试讲成功
 * @param params
 * @param call
 */
export function trialSuccess(params, call) {
    requestHandle(request({
        url:`${API_PREFIX}/tutor/action/trialSuccess`,
        method: 'POST',
        params
    }), call)
}

/**
 *  --------------------------------------- 家教 待定订单 End ---------------------------------------
 */




/**
 *  --------------------------------------- 家教 退款处理 Start ---------------------------------------
 * 
 *  一些失效的交易，可以发起退费申请，由平台审核，审核通过的将发起微信退款流程。视情况决定退款比率，如果支付时间过去太久，微信平台不支持退款，会退款失败
 */


export function PostRefund (params) {
    return request({
        url: '/tutor/action/refund',
        method: 'post',
        params
    })
}


/**
 * 查找失败的订单
 * @param params
 * @returns {AxiosPromise}
 * @constructor
 */
export function FailOrder (params, call) {
    requestHandle(request({
        url: `${API_PREFIX}/tutor/action/failOrders`,
        method: 'get',
        params
    }), call);
}


/**
 * 列表查看退款申请 GET   
 * 
 * @method GetListRefund
 * 
 */

export function GetListRefund (params) {
    return request({
        url: '/tutor/action/listRefund',
        method: 'get',
        params
    })
}


/**
 * 退款详情 GET   
 * 
 * @method GetDetailsRefund
 * 
 */

export function GetDetailsRefund (params) {
    return request({
        url: '/tutor/action/detailsRefund',
        method: 'get',
        params
    })
}


/**
 *  --------------------------------------- 家教 退款处理 End ---------------------------------------
 */




/**
 *  --------------------------------------- 家教 正在教学 Start ---------------------------------------
 */


/**
 * 正在教学列表 GET  
 * 
 * @method GetWorkingOrders
 * 
 */

export function GetWorkingOrders (params) {
    return request({
        url: '/tutor/action/workingOrders',
        method: 'get',
        params
    })
}


/**
 * 查看正在教学详情 GET
 * 
 * @method GetDetailsWorkingOrder
 * 
 */

export function GetDetailsWorkingOrder (params) {
    return request({
        url: '/tutor/action/detailsWorkingOrder',
        method: 'get',
        params
    })
}


/**
 *  --------------------------------------- 家教 正在教学 End ---------------------------------------
 */




/**
 *  --------------------------------------- 家教 历史订单 Start ---------------------------------------
 */


/**
 * 历史订单列表  GET  
 * 
 * @method GetHistoryOrders
 * 
 */

export function GetHistoryOrders (params) {
    return request({
        url: '/tutor/action/historyOrders',
        method: 'get',
        params
    })
}


/**
 * 历史订单详情 GET 
 * 
 * @method GetDetailsHistoryOrder
 * 
 */

export function GetDetailsHistoryOrder (params) {
    return request({
        url: '/tutor/action/detailsHistoryOrder',
        method: 'get',
        params
    })
}


/**
 *  --------------------------------------- 家教 历史订单 End ---------------------------------------
 */
